package com.qianhui.listener;

import com.qianhui.common.GlobalConfig;
import com.qianhui.dao.ShopDAO;
import com.qianhui.pojo.Shop;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class AddGlobalContentListener implements ServletContextListener
{

    @Override
    public void contextInitialized(ServletContextEvent sce)
    {
        ShopDAO shopDAO = new ShopDAO();
        Shop shop = shopDAO.findById("qianhui");
        sce.getServletContext().setAttribute("shopApplication", shop);
        GlobalConfig.web_server_root_path = sce.getServletContext().getRealPath("/");
    }

    @Override
    public void contextDestroyed(ServletContextEvent arg0)
    {

    }

}
